#pragma once
#include <tchar.h>
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <utility>
#include <memory>
#include <mutex>
#include <windows.h>
#include <stdio.h>
#include <corecrt_wstdio.h>
#include <stdlib.h>
#include <vcruntime_string.h>
#include "SDL2/SDL.h"
#include "SDL2/SDL_render.h"
#include "SDL2/SDL_keyboard.h"
#include "glm/glm.hpp"
#include "glm/ext.hpp"
#include "glew/glew.h"
#include <gl/GLU.h>
#include "freetype/ft2build.h"
#include "freetype/freetype.h"
#include "freeimage/FreeImage.h"
#include "tinyxml/tinyxml.h"
#include "TString.h"

using namespace std;
using namespace glm;
#pragma comment(lib,"opengl32.lib")
#pragma comment(lib,"glu32.lib")
#pragma comment(lib,"glew32s.lib")
#pragma comment(lib,"SDL2main.lib")
#pragma comment(lib,"SDL2.lib")
#pragma comment(lib,"freetypes.lib")
#ifdef _DEBUG
#pragma comment(lib,"Freeimaged.lib")
#else
#pragma comment(lib,"Freeimage.lib")
#endif // _DEBUG



#ifdef _UNICODE
//using tstring = std::wstring;
using tstringstream = std::wstringstream;
#define tscanf swscanf_s //wscanf_s
#define tcout std::wcout
#else
#define tcout std::wcout
#define  tscanf sscanf_s
#endif

static void glmVertex2f(vec2 v) { glVertex2f(v.x, v.y); }
static void glmNormal2f(vec2 v) { glVertex2f(v.x, v.y); }
static void glmTexCoord2f(vec2 v) { glTexCoord2f(v.s, v.t); }


static void glmVertex3f(vec3 v) { glVertex3f(v.x, v.y, v.z); }
static void glmNormal3f(vec3 v) { glVertex3f(v.x, v.y, v.z); }
static void glmColor3f(vec3 v) { glColor3f(v.x, v.y, v.z); }
static glm::vec3 ConvertToColor(tstring str)
{
	int r, g, b;
	tscanf(str.wstrdata(), _T("#%2x%2x%2x"), &r, &g, &b); //&vclr.r, &vclr.g, &vclr.b);
	
	glm::vec3 vclr(r,g,b);
	return vclr / 255.0;
}
